<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html>
<head>
<title>Introduction to Java Gnome</title>
<link rel="stylesheet" href="/cfg/format.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="GUI, Introduction to Java Gnome, Java Gnome library, Java, Linux, programming">
<meta name="description" content="Introduction to Java Gnome">
<meta name="language" content="en">
<meta name="author" content="Jan Bodnar">
<meta name="distribution" content="global">

<script type="text/javascript" src="/lib/jquery.js"></script>
<script type="text/javascript" src="/lib/common.js"></script>

</head>

<body>

<div class="container">

<div id="wide_ad" class="ltow">
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* 160x600, August 2011 */
google_ad_slot = "2484182563";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div class="content">


<a href="/" title="Home">Home</a>&nbsp;
<a href="..">Contents</a>


<h1>Introduction to Java Gnome</h1>


<h2>About this tutorial</h2>

<p>
This is an introductory Java Gnome programming tutorial.
The tutorial is targeted for the Java programming language. 
It has been created and tested on Linux. The Java Gnome
programming tutorial is suited for novice and 
intermediate programmers. 
</p>

<div class="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-9706709751191532";
/* top_horizontal */
google_ad_slot = "3327173442";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<p>
You can download images used in this tutorial <a href="/img/gui/javagnome/images.tgz">here</a>.
</p>


<h2>Java Gnome</h2>

<p>
Java Gnome is a wrapper over the GTK+ and Gnome for the Java programming language. 
</p>

<p>
The <b class="keyword">GTK+</b> is a library for creating graphical user 
interfaces. The library is created in C programming language. The GTK+ 
library is also called the GIMP Toolkit. Originally, the library was created
while developing the GIMP image manipulation program. Since then, the GTK+ 
became one of the most popular toolkits under Linux and BSD Unix. Today, 
most of the GUI software in the open source world is created in Qt or in GTK+.
The GTK+ is an object oriented application programming interface. There are 
several bindings to other programming languages. Language bindings exist for 
C++, Python, Perl, Java, C# and other programming languages. 
</p>

<p>
<b class="keyword">GNOME</b> is a desktop environment, the graphical 
user interface which runs on top of a computer operating system. 
It is an international project that includes creating software
development frameworks, selecting application software for the desktop, 
and working on the programs which manage application launching, file handling, 
and window and task management. GNOME is part of the GNU Project
and can be used with various Unix-like operating systems. (wikipedia.org)
</p>

<h2>Tips for development</h2>

<p>
Do use the official Sun JDK. Don't use any other derivatives or alternatives. 
You have been warned. 
</p>

<p>
Download the latest version of the Java Gnome library. Compile and install
it manually. 
</p>

<pre>
 ./configure --jdk=/home/vronskij/bin/jdk1.6.0_11/
</pre>

<p>
If you have OpenJDK or any other non standard java development kit installed on 
your system, you run the configure script with the path pointing to the installed
Sun JDK. 
</p>

<p>
After you successfully build your Java Gnome library, you should have
two files. The gtk-4.0.jar and the libgtkjni-4.0.10.so. In case you
have downloaded java-gnome 4.0.10. 
</p>

<p>
There is a long standing issue with launching Java Gnome applications.
Normally, you would need to create a script to launch every java gnome
application. According to the website, it is resolved but
it did not work for me. I did a workaround by copying the libgtkjni-4.0.10.so 
where the gtk-4.0.jar is. 
</p>

<pre>
$ ls
gtk-4.0.jar  libgtkjni-4.0.10.so 
$ pwd 
/usr/local/share/java
</pre>

<p>
I work with JDeveloper and this workaround solved this issue.
</p>

<br>
<img src="/img/gui/javagnome/jdevlib.png" alt="Adding Java Gnome library">
<div class="figure">Figure: Adding Java Gnome library</div>

<p>
When you create a new project in JDeveloper, you need to add
the gtk-4.0.jar to the project libraries. From this point, running
the application is a simple F11. 
</p>


<h2>Sources</h2>

<ul>
<li><a href="http://java-gnome.sourceforge.net">java-gnome.sourceforge.net</a></li>
<li><a href="http://wikipedia.org">wikipedia.org</a></li>
</ul>

<hr class="btm">

<p>
This was an introduction to the Java Gnome library.
</p>

<br>
<div class="center"> 
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* horizontal */
google_ad_slot = "1734478269";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script> 
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 
</script> 
</div> 
<br>

<div class="botNav, center">
<span class="botNavItem"><a href="/">Home</a></span> ‡ <span class="botNavItem"><a href="..">Contents</a></span> ‡ 
<span class="botNavItem"><a href="#">Top of Page</a></span>
</div>


<div class="footer">
<div class="signature">
<a href="/">ZetCode</a> last modified March 13, 2009  <span class="copyright">&copy; 2007 - 2012 Jan Bodnar</span>
</div>
</div>

</div> <!-- content -->

</div> <!-- container -->

</body>
</html>


